﻿<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace=" System.Collections" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="TarreOA.TarreOAModels" %>
<%@ Import Namespace="TarreOA.TarreOABLL" %>

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.QueryString.Get("thl_Id") != null)
            {
                string thl_Id = Request.QueryString.Get("thl_Id");
                UserTalkContent utc = UserTalkContent.instance();
                User curLoginUser = (User)Session["user"];
                List<User> userList = null;
                List<string> talkList = null;
                if (utc.TalkUsers["Talk" + thl_Id] == null)
                {
                    userList = new List<User>();
                    utc.AddToTalkUsers("Talk" + thl_Id, userList);
                }
                userList = ((List<User>)utc.TalkUsers["Talk" + thl_Id]);
                if (utc.TalkContents["Talk" + thl_Id] == null)
                {
                    talkList = new List<string>();
                    utc.AddToTalkContents("Talk" + thl_Id, talkList);
                }
                talkList = ((List<string>)utc.TalkContents["Talk" + thl_Id]);
                if (userList != null && userList.Count > 0)
                {
                    if (userList.Remove(curLoginUser))
                    {
                        talkList.Add("[<font color=''><b>" + curLoginUser.UserName + "</b></font>]礼貌的点了点头，开门离去！<font color='#a9a9a9'>["
                            + DateTime.Now.ToString() + "]</font>");
                    }
                }
                userList.Add(curLoginUser);
                talkList.Add("[<font color=''><b>" + curLoginUser.UserName + "</b></font>]轻轻推开门，走了进来！<font color='#a9a9a9'>["
                    + DateTime.Now.ToString() + "]</font>");
                utc.TalkContents["Talk" + thl_Id] = talkList;
                utc.TalkUsers["Talk" + thl_Id] = userList;
                Response.Redirect("TalkIndex.aspx?thl_id=" + thl_Id);
            }
        } 
    }
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>
